<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Help</title>
    <link href="/public/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link title="style2" href="/public/assets/css/style.css" rel="stylesheet"/>
    <script src="/public/assets/js/jquery.min.js"></script>
    <style>
        .main-container{
            background: #FFF;
            margin:100px auto;
        }
        * {
            margin: 0;
            padding: 0;
        }

        html {
            height: 100%;
            width: 100%;
            overflow: hidden;
            margin: 0;
            padding: 0;
            background: url(/public/img/loginregistBack.png) no-repeat 0px 0px;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            -moz-background-size: 100% 100%;
        }

        body {
            display: flex;
            align-items: center;
            justify-content: center;
            height: 100%;
            position: relative;
        }

        #loginDiv {
            width: 37%;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 650px;
            background-color: rgba(75, 81, 95, 0.3);
            box-shadow: 7px 7px 17px rgba(52, 56, 66, 0.5);
            border-radius: 5px;
        }

        #name_trip {
            margin-left: 50px;
            color: red;
        }

        p,
        .sexDiv {
            margin-top: 10px;
            margin-left: 20px;
            color: azure;
        }

        .sexDiv>input,
        .hobby>input {
            width: 30px;
            height: 17px;
        }

        input,
        select {
            margin-left: 15px;
            border-radius: 5px;
            border-style: hidden;
            height: 36px;
            width: 304px;
            background-color: rgba(216, 191, 216, 0.5);
            outline: none;
            color: #f0edf3;
            padding-left: 10px;
        }

        .button {
            border-color: cornsilk;
            background-color: rgba(100, 149, 237, .7);
            color: aliceblue;
            border-style: hidden;
            border-radius: 5px;
            width: 100px;
            height: 31px;
            font-size: 14px;
        }

        .introduce {
            margin-left: 110px;
        }

        .introduce>textarea {
            background-color: rgba(216, 191, 216, 0.5);
            border-style: hidden;
            outline: none;
            border-radius: 5px;
        }

        h3 {
            text-align: center;
            margin-bottom: 20px;
            margin-top: 20px;
            color: #f0edf3;
        }

        b {
            margin-left: 50px;
            color: #FFEB3B;
            font-size: 10px;
            font-weight: initial;
        }
    </style>
</head>
<body>
<input type="button" style="position: absolute;
    left: 14px;
    top: 14px;" value="返回" onclick="javascript:history.back();">
<div id="loginDiv">

    <form action="">
        <h3>个人信息</h3>
        <p>
            用户姓名:
            <input id="username" name="username" value="<?php echo $username; ?>" type="text" autofocus required>
            <label id="name_trip"></label>
        </p>
        <p>
        <div class="sexDiv">
            用户性别:
            <input  style="    width: 42px;
    height: 34px;" name="sex" value="<?php echo $sex; ?>" type="text">
        </div>
        <p>
            手机号:
            <input id="tel" name="tel" type="text" value="<?php echo $tel; ?>">
            <label id="birthday_trip"></label>
        </p>
        <p>
            电子邮件:
            <input id="email" name="email" type="email" value="<?php echo $email; ?>" required>
            <label id="emil_trip"></label>
        </p>
        <p> 自我介绍:</p>
        <div class="introduce">
            <textarea name="introduce"  style="resize: none;width: 280px;height: 230px;"  cols="30" id="introduceText"   required rows="10">
                <?php echo $introduce; ?>
            </textarea>
            <label id="introduce_trip"></label>
        </div>
        <p style="text-align: center;">
            <input type="button" style="width: 100px;height: 44px;" class="isbutton" value="提交">
        </p>
    </form>
</div>
<script type="text/javascript">
    $('.isbutton').on('click',function() {
            $.ajax({
                url: "/index.php?c=infomation&a=checked",
                type: "POST",
                data: {
                    username: $("input[name='username']").val(),
                    sex: $("input[name='sex']").val(),
                    tel: $("input[name='tel']").val(),
                    email: $("input[name='email']").val(),
                    introduce: $('#introduceText').val()
                },
                dataType: "json",
                success: function (data) {
                    console.log(data)
                    if (data.flag) {
                        alert(data.msg);
                        location.href = "/index.php?c=infomation&a=localInfo";
                    } else {
                        alert(data.msg);
                    }
                },
                error: function () {
                    alert("请求失败")
                }
            });
    });

</script>
</body>
</html>